﻿@using Webdiyer.WebControls.Mvc
@model PagedList<Dyd.BaseService.ConfigManager.Domain.Model.tb_config_model>
@{
    ViewBag.Title = "配置列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
    .search label {
        min-width: 70px;
    }
</style>
<div class="head">
    <div class="title">
        @ViewBag.Title
    </div>
</div>
<div>
    @Html.ActionLink("新增", "ConfigAdd", null, new { @class = "btn1", target = "_blank" })
</div>
<div class="orderlist m10 myorder">
    @Html.AntiForgeryToken()

    @using (Html.BeginForm("ConfigIndex", "Config", FormMethod.Get, new RouteValueDictionary { { "id", "searchForm" } }))
    {
        <div class="search">
            @*            <ul>
                <li>*@
            <label>配置分类</label>@Html.DropDownList("categoryid", ViewBag.Category as List<SelectListItem>)

            <label>配置键</label><input type="text" class="text midtext" style="width:150px;" name="configkey" value="@ViewBag.Configkey" />
            <label>配置值</label><input type="text" class="text midtext" style="width:150px;" name="configvalue" value="@ViewBag.Configvalue" />
            <label>备注</label><input type="text" class="text midtext" style="width:150px;" name="remark" value="@ViewBag.remark" />
            <input type="submit" class="btn1" value="搜索" accesskey="S" />
            @*<label>时间</label><input type="text" class="text midtext" style="width:150px;" name="startTime" onclick="WdatePicker()" value="@ViewBag.startTime.ToString("yyyy-MM-dd")" /> -<input type="text" class="text midtext" style="width:150px;" name="endTime" onclick="WdatePicker()" value="@ViewBag.endTime.ToString("yyyy-MM-dd")" />*@
            @*                </li>
                </ul>*@
        </div>
    }
    <div class="tab_cont">
        <div class="List">
            @Html.Partial("_ConfigIndex", Model)
        </div>
    </div>
</div>
@section Scripts{
    <script>
        $(function () {
            $("body").on("click", ".edit", function () {
                var id = $(this).parent().parent().attr("data-id");
                var url = "/Config/ConfigEdit/" + id;
                window.location = url;
            });

            $("body").on("click", ".del", function (e) {
                var id = $(this).parent().parent().attr("data-id");
                var url = "/Config/ConfigDel";
                if (window.confirm("确定要删除吗？")) {
                    $.post(url, addAntiForgeryToken({ id: id }), function (data) {
                        if (data.Flag) {
                            alert(data.Message);
                            window.location.reload();
                        }
                        else {
                            alert(data.Message);
                        }
                    }, "json");
                }
            });
        });

    </script>
}
